<?php
namespace app\admin\controller;
use app\Base;
use think\facade\Db;
class Data extends Base{
	
    public function payIndex()
    {
		if(!$this->request->post('page') || !$this->request->post('pageSize'))
		{
			return $this->kerror('参数不正确');
		}
		
		$pageSet=array('page'=>$this->request->post('page'),'list_rows'=>$this->request->post('pageSize'));
		
		$dataList=Db::name('paylist')->where('status',1)->order("id","desc")->paginate($pageSet)->each(function($item,$key){
			$item['rq']=date("Y-m-d",$item['inputtime']);
			$item['username']=Db::name('member')->where("userid",$item['userid'])->value('username');
			if($item['orderid'])
			{
				$order=Db::name('order')->where("orderid",$item['orderid'])->find();
				$type=Db::name('order_type')->where("en",$order['type'])->value('name');
				$item['title']=$type."(编号:".$item['orderid'].")";
			}
			else{
				$item['title']='在线充值';
			}
			return $item;
		})->toArray()['data'];
		
		$total=Db::name('paylist')->where('status',1)->count();
		
		$this->setobj(array('dataList'=>$dataList,'total'=>$total));
				
		return $this->ok();
    }
	
	
	 
	
}
